/*
 Navicat Premium Data Transfer

 Source Server         : localhost
 Source Server Type    : MySQL
 Source Server Version : 80019
 Source Host           : localhost:3306
 Source Schema         : blog

 Target Server Type    : MySQL
 Target Server Version : 80019
 File Encoding         : 65001

 Date: 06/08/2020 14:15:45
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for blog_article
-- ----------------------------
DROP TABLE IF EXISTS `blog_article`;
CREATE TABLE `blog_article` (
  `id` int unsigned NOT NULL AUTO_INCREMENT,
  `title` varchar(32) NOT NULL,
  `content` text NOT NULL,
  `category_id` int unsigned NOT NULL,
  `created_time` varchar(32) NOT NULL,
  `updated_time` varchar(32) DEFAULT '',
  `status` varchar(16) NOT NULL DEFAULT 'published',
  PRIMARY KEY (`id`),
  UNIQUE KEY `title` (`title`) USING BTREE,
  KEY `category` (`category_id`),
  CONSTRAINT `category` FOREIGN KEY (`category_id`) REFERENCES `blog_category` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=49 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- ----------------------------
-- Records of blog_article
-- ----------------------------
BEGIN;
INSERT INTO `blog_article` VALUES (1, 'Go基础', 'Learning go', 1, '2020-06-19 15:39:24', '2020-06-19 15:39:24', 'published');
INSERT INTO `blog_article` VALUES (2, 'Vue基础', 'Learning vue', 1, '2020-06-19 15:39:24', '2020-06-19 15:39:24', 'published');
INSERT INTO `blog_article` VALUES (35, '121', 'qqq', 2, '2020-06-28 15:01:06', '', 'published');
INSERT INTO `blog_article` VALUES (38, 'qq', 'qqwqw', 3, '2020-06-28 15:02:05', '', 'published');
INSERT INTO `blog_article` VALUES (39, '32', '323232', 4, '2020-06-28 15:09:29', '', 'published');
INSERT INTO `blog_article` VALUES (40, '1111', '121', 1, '2020-06-28 15:15:33', '', 'published');
INSERT INTO `blog_article` VALUES (41, '1112', '121', 1, '2020-06-28 15:15:37', '', 'published');
INSERT INTO `blog_article` VALUES (42, '323', '121', 1, '2020-06-28 15:15:42', '', 'published');
INSERT INTO `blog_article` VALUES (43, 'qqq', '121', 1, '2020-06-28 15:15:45', '', 'published');
INSERT INTO `blog_article` VALUES (44, 'q12', '121', 1, '2020-06-28 15:15:49', '', 'published');
INSERT INTO `blog_article` VALUES (45, '312', '121', 1, '2020-06-28 15:15:52', '', 'published');
INSERT INTO `blog_article` VALUES (46, '43', '121', 1, '2020-06-28 15:15:55', '', 'published');
INSERT INTO `blog_article` VALUES (47, '23123', '1111\n2122\n333', 1, '2020-06-28 21:34:40', '2020-06-28 21:42:19', 'published');
INSERT INTO `blog_article` VALUES (48, '123', '1111', 1, '2020-06-28 21:37:13', '2020-06-29 16:56:13', 'published');
COMMIT;

-- ----------------------------
-- Table structure for blog_category
-- ----------------------------
DROP TABLE IF EXISTS `blog_category`;
CREATE TABLE `blog_category` (
  `id` int unsigned NOT NULL AUTO_INCREMENT,
  `category_name` varchar(16) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- ----------------------------
-- Records of blog_category
-- ----------------------------
BEGIN;
INSERT INTO `blog_category` VALUES (1, 'go');
INSERT INTO `blog_category` VALUES (2, 'Java');
INSERT INTO `blog_category` VALUES (3, 'Vue');
INSERT INTO `blog_category` VALUES (4, 'vv');
INSERT INTO `blog_category` VALUES (5, '55');
INSERT INTO `blog_category` VALUES (6, '66');
INSERT INTO `blog_category` VALUES (7, '77');
INSERT INTO `blog_category` VALUES (8, '88');
INSERT INTO `blog_category` VALUES (9, '99');
INSERT INTO `blog_category` VALUES (10, '100');
COMMIT;

-- ----------------------------
-- Table structure for blog_comment
-- ----------------------------
DROP TABLE IF EXISTS `blog_comment`;
CREATE TABLE `blog_comment` (
  `id` int unsigned NOT NULL AUTO_INCREMENT,
  `username` varchar(16) NOT NULL,
  `is_author` tinyint(1) NOT NULL DEFAULT '0',
  `parent_id` int unsigned DEFAULT NULL,
  `root_id` int unsigned DEFAULT NULL,
  `article_id` int unsigned NOT NULL,
  `content` varchar(255) NOT NULL,
  `created_time` varchar(255) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `article` (`article_id`),
  KEY `parent` (`parent_id`),
  KEY `root` (`root_id`),
  CONSTRAINT `article` FOREIGN KEY (`article_id`) REFERENCES `blog_article` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `parent` FOREIGN KEY (`parent_id`) REFERENCES `blog_comment` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `root` FOREIGN KEY (`root_id`) REFERENCES `blog_comment` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=43 DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of blog_comment
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for blog_soup
-- ----------------------------
DROP TABLE IF EXISTS `blog_soup`;
CREATE TABLE `blog_soup` (
  `id` int unsigned NOT NULL AUTO_INCREMENT,
  `content` tinytext NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=20 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- ----------------------------
-- Records of blog_soup
-- ----------------------------
BEGIN;
INSERT INTO `blog_soup` VALUES (2, '11121212');
INSERT INTO `blog_soup` VALUES (3, '11121212');
INSERT INTO `blog_soup` VALUES (4, '11121212');
INSERT INTO `blog_soup` VALUES (5, '11121212');
INSERT INTO `blog_soup` VALUES (9, 'qwsaxz');
INSERT INTO `blog_soup` VALUES (10, 'qwsaxz');
INSERT INTO `blog_soup` VALUES (11, 'qwsaxz');
INSERT INTO `blog_soup` VALUES (12, '1qazx');
INSERT INTO `blog_soup` VALUES (13, '12\n21\n32');
INSERT INTO `blog_soup` VALUES (14, '21212');
INSERT INTO `blog_soup` VALUES (15, '22');
INSERT INTO `blog_soup` VALUES (16, '1qa');
INSERT INTO `blog_soup` VALUES (17, '323\n323');
INSERT INTO `blog_soup` VALUES (18, '0988');
INSERT INTO `blog_soup` VALUES (19, '3232\n32323');
COMMIT;

-- ----------------------------
-- Table structure for blog_tag
-- ----------------------------
DROP TABLE IF EXISTS `blog_tag`;
CREATE TABLE `blog_tag` (
  `id` int unsigned NOT NULL AUTO_INCREMENT,
  `tag_name` varchar(16) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=29 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- ----------------------------
-- Records of blog_tag
-- ----------------------------
BEGIN;
INSERT INTO `blog_tag` VALUES (6, 'Pro');
INSERT INTO `blog_tag` VALUES (8, 'Air');
INSERT INTO `blog_tag` VALUES (10, '1213qweq');
INSERT INTO `blog_tag` VALUES (20, 'vv');
INSERT INTO `blog_tag` VALUES (21, 'cv');
INSERT INTO `blog_tag` VALUES (28, '33\n323\n323\n212');
COMMIT;

-- ----------------------------
-- Table structure for blog_tag_article
-- ----------------------------
DROP TABLE IF EXISTS `blog_tag_article`;
CREATE TABLE `blog_tag_article` (
  `id` int unsigned NOT NULL AUTO_INCREMENT,
  `tag_id` int unsigned NOT NULL,
  `article_id` int unsigned NOT NULL,
  PRIMARY KEY (`id`),
  KEY `tag_id` (`tag_id`),
  KEY `article_id` (`article_id`),
  CONSTRAINT `article_id` FOREIGN KEY (`article_id`) REFERENCES `blog_article` (`id`),
  CONSTRAINT `tag_id` FOREIGN KEY (`tag_id`) REFERENCES `blog_tag` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=39 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- ----------------------------
-- Records of blog_tag_article
-- ----------------------------
BEGIN;
INSERT INTO `blog_tag_article` VALUES (36, 10, 47);
INSERT INTO `blog_tag_article` VALUES (38, 8, 48);
COMMIT;

-- ----------------------------
-- Table structure for blog_user
-- ----------------------------
DROP TABLE IF EXISTS `blog_user`;
CREATE TABLE `blog_user` (
  `id` int unsigned NOT NULL AUTO_INCREMENT,
  `username` varchar(16) NOT NULL,
  `password` varchar(255) NOT NULL,
  `avatar` varchar(255) DEFAULT NULL,
  `introduction` varchar(255) DEFAULT NULL,
  `nickname` varchar(32) DEFAULT NULL,
  `about` text,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- ----------------------------
-- Records of blog_user
-- ----------------------------
BEGIN;
INSERT INTO `blog_user` VALUES (2, 'admin', 'e10adc3949ba59abbe56e057f20f883e', 'https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=2884107401,3797902000&fm=26&gp=0.jpg', 'a gopher', 'gopher', '## hello world');
COMMIT;

SET FOREIGN_KEY_CHECKS = 1;
